package com.userautentification.dao.imp;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.userautentification.dao.AddressDao;
import com.userautentification.dao.DataAccessLayerException;
import com.userautentification.dao.HibernateFactory;
import com.userautentification.dao.PhoneDao;
import com.userautentification.entities.Address;
import com.userautentification.entities.Phone;

public class PhoneDaoImp extends GenericDaoHibernate<Phone, Long> implements
		PhoneDao {

	Log log = LogFactory.getLog(PhoneDaoImp.class);

	public PhoneDaoImp() {
		HibernateFactory.buildIfNeeded();
	}

	/**
	 * Insert a new Address into the database.
	 * 
	 * @param phone
	 */
	public void create(Phone phone) throws DataAccessLayerException {
		super.create(phone);
	}

	/**
	 * Delete a detached Address from the database.
	 * 
	 * @param phone
	 */
	public void delete(Phone phone) throws DataAccessLayerException {
		super.delete(phone);
	}

	/**
	 * Find an Phone by its primary key.
	 * 
	 * @param id
	 * @return
	 */
	public Phone find(Long id) throws DataAccessLayerException {
		return (Phone) super.find(Phone.class,id);
	}

	/**
	 * Updates the state of a detached Address.
	 * 
	 * @param phone
	 */
	public void update(Phone phone) throws DataAccessLayerException {
		super.update(phone);
	}

	/**
	 * Finds all Phone in the database.
	 * 
	 * @return
	 */
	public List findAll() throws DataAccessLayerException {
		return super.findAll(Phone.class);
	}

}